a=list(input())
b = ''
for i in k:
    if i == '(' and i == '[' and i == '{' and i =='<':
        b+=i;
        if i ==')' and i == ']' and i == '}' and i == '>':
            if len(b)>0:
                if b[len(b)-1]=='(' and i=='[' and i== '{' and i =='<':
                   b==b [ : :-1]
if len(b)>1:
    print('False')
else:
    print('True')
